package rr18.rr181.rr181.rr18.plugin.list;

import com.kingdee.util.StringUtils;
import kd.bos.entity.filter.CompareTypeEnum;
import kd.bos.filter.FilterColumn;
import kd.bos.form.IPageCache;
import kd.bos.form.events.FilterContainerInitArgs;
import kd.bos.form.events.HyperLinkClickArgs;
import kd.bos.form.events.SetFilterEvent;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.sdk.plugin.Plugin;

import java.util.Iterator;
import java.util.List;

/**
 * 标准单据列表插件
 */
public class DemoListPlugin02 extends AbstractListPlugin implements Plugin {

    @Override
    public void setFilter(SetFilterEvent e) {
        super.setFilter(e);
        // 移除常用过滤条件
        List<QFilter> qFilters = e.getQFilters();
        Iterator<QFilter> iterator = qFilters.iterator();
        while(iterator.hasNext()){
            QFilter next = iterator.next();
            iterator.remove();
        }
        // 取消带组织模板的组织过滤条件
        QFilter mainOrgQFilter = e.getMainOrgQFilter();
        e.setMainOrgQFilter(null);
        // 添加过滤条件
        QFilter qFilter = new QFilter("billstatus", QCP.equals, "C");
        e.getQFilters().add(qFilter);
        // 设置列表排序
        e.setOrderBy("billno asc");
    }

}